<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <link rel="stylesheet" href="__CSS__/tpcitrix.css"  media="all">
  <style type="text/css">
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
  </style>
</head>
<body class="patch_body">
<fieldset class="layui-elem-field site-demo-button" style="margin: 30px 10px;">
  <legend>导航主题{if condition="$type eq 1"}【主导航】{elseif condition="$type eq 2"}【顶导航】{elseif condition="$type eq 3"}【底导航】{/if}</legend>
  <div style="margin: 30px 40px 40px 40px;">
      <a href="{:url('admin/nav/index',['type'=>1])}" class="layui-btn layui-btn-normal" >主导航</a>
      <a href="{:url('admin/nav/index',['type'=>2])}" class="layui-btn layui-btn-warm" >顶导航</a>
      <a href="{:url('admin/nav/index',['type'=>3])}" class="layui-btn layui-btn-danger" >底导航</a>
  </div>
</fieldset>
<div class="tplay-body-div">

    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">导航列表</li>
        <li><a href="{:url('admin/nav/publish')}" class="a_menu">新增导航</a></li>
      </ul>
    </div> 
    {notempty name="nav"}
    <div class="layui-form">
      <table class="layui-table">
        <colgroup>
          <col width="280">
          <col>
          <!-- <col width="100"> -->
          <col width="100">
          <col width="180">
        </colgroup>
        <thead>
          <tr style="background-color: #ECECEC;">
            <th>链接名称</th>
            <th>链接地址</th>
            <!-- <th>链接LOGO</th> -->
            <th>显示顺序</th>
            <th>操作</th>
          </tr> 
        </thead>
        <tbody>
          {volist name="nav" id="vo"}
          <tr>
            <td >{$vo.str}{$vo.nav_name}</td>
            <td >{$vo.path_url}</td>
            <!-- <td>
            {if condition="$vo.thumb neq 0"}
              <a href="{$vo.thumb|geturl}" class="tooltip">
                <img src="{$vo.thumb|geturl}" width="20" height="20">
              </a>
            {else /}
              <img src="/public/static/admin/images/404.png" width="20" height="20">
            {/if}
            </td> -->
            <td >{$vo.sort}</td>
            <td >
                <a href="{$vo.path_url}"  target="_black" class="layui-btn layui-btn-xs">查看</a> 
                <a href="{:url('admin/nav/publish',['id'=>$vo.id])}" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
              <button class="layui-btn layui-btn-xs layui-btn-danger delete" id="{$vo.id}">
                删除
              </button>
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
      {else}
      <h5 style="padding: 50px;">数据走失咯！快去添加吧</h5>
      {/notempty}
    </div>

    {include file="public/foot"}
    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/nav/delete')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    })
    </script>
</div>
</body>
</html>